from panda3d.core import Vec2,Point3,Vec3,Vec4
'''
	Andrew Oberlin
	
	Date: February 20, 2012
'''
class TitleScreen:
	'''
		Creates a splash screen
	'''
	def __init__(self, parent):
		self.parent = parent
		self.__loadScreen()
		self.__set2DProps()
		self.__setupMenu()

		
	'''
		Loads the textures for the screens
	'''
	def __loadScreen(self):
		self.backgroundTex = self.parent.loader.loadTexture("models/levels/menu_items/title_screen.png")
		self.backgroundModel = self.parent.loader.loadModelCopy("models/plane")
		self.backgroundModel.setTexture(self.backgroundTex)
		
	'''
		Sets the properties for a two dimensional figure
	'''
	def __set2DProps(self):
		self.backgroundModel.setHpr(Vec3(0,-90,0))
		self.backgroundModel.setScale(self.parent.WIN_WIDTH, self.parent.BLOCK_SIZE, self.parent.WIN_HEIGHT)
		self.backgroundModel.setPos(self.parent.WIN_WIDTH/2, self.parent.WIN_HEIGHT/2,0)
		
		# maximize efficiency
		self.backgroundModel.setBin("unsorted", 0)
		self.backgroundModel.setDepthTest(False)
		self.backgroundModel.setTransparency(1)

		self.backgroundModel.reparentTo(render)
		
	'''
		Places this object on the screen
	'''
	def show(self):
		self.parent.level.hide()
		self.backgroundModel.show()
		
	'''
		Hides the title screen
	'''
	def hide(self):
		self.backgroundModel.hide()
		
	'''
		Setup Menu
	'''
	def __setupMenu(self):		
		self.parent.accept("enter", self.parent.startGame)
		
		
		
		
		
		